home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group94a.txt
/
000180_icon-group-sender _Mon Jun 20 09:34:17 1994.msg
< prev
next >
Wrap
Internet Message Format
|
1994-08-19
|
914b
Received: by cheltenham.cs.arizona.edu; Mon, 20 Jun 1994 12:14:22 MST
Date: Mon, 20 Jun 94 09:34:17 PDT
From: eric@star-semi.com (Eric Armstrong)
Message-Id: <9406201634.AA28443@star-semi.com>
To: icon-group@cs.arizona.edu
Subject: anti-ugly contest
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Help stamp out ugly icon code!
I'm getting better. My first ugly version of the following routine,
produced after much trial and error, required two (count 'em!) extra
variables. After some inspection, I managed to reduce it to:
procedure squeeze(s)
# Squeze out excess blanks from inside a string
s2 := ""
s ? {
while s2 ||:= tab(upto(" ")+1) do tab(many(" "))
s2 ||:= tab(0)
}
return s2
end
That cut the number of extra variables down to one (s2).
Question: Is there an even more elegant way to do this that requires
no extra variables?